import Vue from 'vue'
import Router from 'vue-router'
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
import store from '../store/store'
// 首页
import Index from "../page";
// 缴费操作
import PaymentOperation from "../page/PaymentOperation/assest/router";
// 缴费系统设置
import SystemSetup from "../page/SystemSetup/assest/router.js";
// 实例
import ReportForm from "../page/ReportForm/assest/router.js";
import SpecialTrainingFeeAndDeduction from "../page/SpecialTrainingFeeAndDeduction/assest/router.js";
// 总报表
import GeneralStatement from "../page/GeneralStatement/assest/router.js";

import Home from "../page/home";
import { mapState } from 'vuex';

import login from "../page/login";
import notFind from "../page/notFind"
import getMessage from "../page/login";

Vue.use(Router)

const router = new Router({
    mode: 'history',
    routes: [
        {
          path: '/Login',
          name:'Login',
          component:login
        },
        {
            path: '/',
            component: Index,
            redirect: "/Pay",
            children: [
                {
                    path: '/Pay',
                    name: 'Pay',
                    component: Home
                },
                //缴费设置↓
                ...PaymentOperation,
                //系统设置↓
                ...SystemSetup,
                //报表↓
                ...ReportForm,
                //特训费及减免管理↓
                ...SpecialTrainingFeeAndDeduction,
                // 总报表
                ...GeneralStatement

            ]
        },{
          path:'*',
          component:notFind // 或者使用component也可以的
        }
    ]
})
router.beforeEach((to, from, next) => {
    next();
})
export default router
